import allure
import pymysql


def sql_assert(sql,index):
    conn = pymysql.connect(
        host='192.168.10.131',
        port=3306,
        database='mydb',
        user='root',
        password='123456',
        charset='utf8',
    )
    cur = conn.cursor()
    cur.execute(sql)
    result = cur.fetchone()
    cur.close()
    conn.close()
    return result[index]


def sql_get(sql):
    conn = pymysql.connect(
        host='192.168.10.131',
        port=3306,
        database='mydb',
        user='root',
        password='123456',
        charset='utf8',
    )
    cur = conn.cursor()
    cur.execute(sql)
    result = cur.fetchone()
    cur.close()
    conn.close()
    return result[0]
